﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using DatabaseSchemaReader;
using DatabaseSchemaReader.DataSchema;

namespace Happy.Edge.DatabaseSchemaReader.Extentions
{
    public static class DataTypeExtentions
    {
        public static object ToDynamic(this DataType dataType)
        {
            if (dataType == null)
            {
                return new { };
            }

            return new
            {
                isDateTime = dataType.IsDateTime,
                isFloat = dataType.IsFloat,
                isInt = dataType.IsInt,
                isNumeric = dataType.IsNumeric,
                isString = dataType.IsString,
                netDataType = dataType.NetDataType,
                netDataTypeCSharpName = dataType.NetDataTypeCSharpName,
                typeName = dataType.TypeName
            };
        }
    }
}
